module counter (
    input             clk,
    input             rst,
    input             en,
    output reg [31:0] cnt
);
  always @(posedge clk) begin
    if (!rst) begin
      cnt <= 0;
    end else begin
      if (en) begin
        cnt <= cnt + 1;
      end
    end
  end
endmodule
